<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Travian辅助</title>
	<meta name="keywords" content="淮阳网站建设|周口网站建设">
	<meta name="description" content="淮阳网站建设|周口网站建设">
    <meta content="telephone=no" name="format-detection">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="renderer" content="webkit"><!--双引擎浏览器默认webkit打开-->
	<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
	<meta name="full-screen" content="yes">
	<link rel="stylesheet" href="__RES__/css/xcConfirm.css">
    <link rel="stylesheet" href="__RES__/css/uikit1.css">
    <script type="text/javascript" src="__RES__/js/jquery.js"></script>
    <script type="text/javascript" src="__RES__/js/xcConfirm.js"></script>
    <script type="text/javascript" src="__RES__/js/uikit.js"></script>
	
	<style>
	body{ padding:10px;}
	.active{color:#e4392a; border-bottom:3px solid #e4392a;}
	#my-id{ height:720px; line-height:1.8em;}
	#msg1,#msg1{ width:50%}
	#my-id li{word-wrap:break-word; word-break:normal; }
	.task{ width:600px; height:160px;}
	textarea{ width:100%;}
	#bing1 .popBox{
    width: 570px;
    height: 500px;
    margin-left: -285px;
    margin-top: -250px;
	}
	#bing1 .popBox .txtBox{ height:310px;}
	#bing1 .text{ width:50px;}
	#bing1 .text1{ width:30px;}
	#bing2 .popBox{
    width: 570px;
    height: 500px;
    margin-left: -285px;
    margin-top: -250px;
	}
	#bing2 .popBox .txtBox{ height:310px;}
	#bing2 .text{ width:50px;}
	#bing2 .text1{ width:30px;}
	#bing2 .t{ letter-spacing:0.2em;}
	</style>
</head>
<body>
<div class="xcConfirm" id="bing1">
<div class="xc_layer"></div><div class="popBox">
<form id="form1">
<div class="ttBox"><a class="clsBtn" id="clsBtn1"></a><span class="tt">添加</span></div><div class="txtBox">
<div class="uk-form-row">
<label class="uk-form-label" for="form-h-it">用户名：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="user" name="user">
</div>
<label class="uk-form-label" for="form-h-it">密码：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="pwd" class="text" name="pwd">
</div>
<label class="uk-form-label" for="form-h-it">服务器：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="server" name="server">
</div>
<label class="uk-form-label" for="form-h-it">版本：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="version" name="version">
</div>
<label class="uk-form-label" for="form-h-it">参数：</label>
<div class="uk-form-controls">
<textarea name="server_arg" rows="4" id="form-h-it" type="text" placeholder="server_arg"></textarea>
</div>
<label class="uk-form-label" for="form-h-it">种族：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="tribe" name="tribe">
Romanos、Teutões、Gauleses
</div>

</div>
</div><div class="btnArea"><div class="btnGroup"><a id="bing_btn1" class="sgBtn ok">确定</a>
</div></div>
</form>
</div></div>


<div class="xcConfirm" id="bing2">
<div class="xc_layer"></div><div class="popBox">
<form id="form2">
<input type="hidden" name="id" value="">
<div class="ttBox"><a class="clsBtn" id="clsBtn2"></a><span class="tt">编辑</span></div><div class="txtBox">
<div class="uk-form-row">
<label class="uk-form-label" for="form-h-it">用户名：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="user" name="user">
</div>
<label class="uk-form-label" for="form-h-it">密码：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="pwd" class="text" name="pwd">
</div>
<label class="uk-form-label" for="form-h-it">服务器：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="server" name="server">
</div>
<label class="uk-form-label" for="form-h-it">版本：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="version" name="version">
</div>
<label class="uk-form-label" for="form-h-it">参数：</label>
<div class="uk-form-controls">
<textarea name="server_arg" rows="4" id="form-h-it" type="text" placeholder="server_arg"></textarea>
</div>
<label class="uk-form-label" for="form-h-it">种族：</label>
<div class="uk-form-controls">
<input type="text" id="form-h-it" placeholder="tribe" name="tribe">
Romanos、Teutões、Gauleses
</div>


</div>
</div><div class="btnArea"><div class="btnGroup"><a id="bing_btn" class="sgBtn ok">确定</a>
</div></div>
</form>
</div></div>
<button class="uk-button uk-button-primary" type="button" id="test2" >添加</button>
<table class="uk-table">
                                    <caption>管理</caption>
                                    <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>用户名</th>
                                            <th>密码</th>
											<th>服务器</th>
											<th>节点</th>
											<th>种族</th>
                                        </tr>
                                    </thead>
                                    <tfoot>
                                        <tr>
                                            <td>ID</td>
                                            <td>用户名</td>
                                            <td>密码</td>
											<td>服务器</td>
											<td>节点</td>
											<td>种族</td>
                                        </tr>
                                    </tfoot>
                                    <tbody>
									{volist name="list" id="v"}
                                        <tr class="{}">
                                            <td>{$v.id}</td>
                                            <td>{$v.user}</td>
                                            <td>{$v.pwd}</td>
											<td>{$v.server}</td>
											<td>{$v.server_arg}</td>
											<td>{$v.tribe}</td>
											<td><span data-ac="edit" data-id="{$v.id}" data-user="{$v.user}" data-pwd="{$v.pwd}" data-server="{$v.server}" data-server_arg='{$v.server_arg}' data-version='{$v.version}' data-tribe="{$v.tribe}">编辑</span> <span data-ac="del" data-id="{$v.id}">删除</span></td>
                                        </tr>
									{/volist}
                                    </tbody>
                                </table>
</body>
<script>
var uid = $('#userinfo').attr('data-uid');
var server = $("#userinfo").attr('data-server'); 
$('#bing1').hide();
$('#bing2').hide();

$('#clsBtn1').click(function(){
    $('#bing1').hide();
});

$('#clsBtn2').click(function(){
    $('#bing2').hide();
});




$('#test2').click(function(){
    $('#bing1').show();
});

$('#bing_btn1').click(function(){
	var btn = $(this);
	btn.attr("disabled", true);
	var obj = $("#form1").serialize();
	//var vid = $('#tab1 .uk-active a').text();
    $.ajax({
        url: "{:url('add_user')}",
        type: 'post',
        cache: false, 
		data: obj,
        dataType: 'json',
        success: function(rs) {
            if(rs.a == 1){location.reload();}else{alert(rs.b);}
	    }
	});
});

$('[data-ac="del"]').click(function(){
    var obj = {};
	obj['id'] = $(this).attr('data-id');
	//var id = $(this).attr('data-id');
	var r=confirm("确定要删除吗？");
	if (r==true){
    $.ajax({
        url: "{:url('user_del')}",
        type: 'get',
        cache: false, 
		data: obj,
        dataType: 'json',
        success: function(rs) {
			if(rs == 1){location.reload();}else{alert('删除失败');}
	    }
	});
	}
});

$('[data-ac="edit"]').click(function(){
    $('[name=id]').val($(this).attr('data-id'));
	$('[name=user]').val($(this).attr('data-user'));
	$('[name=pwd]').val($(this).attr('data-pwd'));
	$('[name=server]').val($(this).attr('data-server'));
	$('[name=server_arg]').html($(this).attr('data-server_arg'));
	$('[name=tribe]').val($(this).attr('data-tribe'));
	$('[name=version]').val($(this).attr('data-version'));
    $('#bing2').show();
});

$('#bing_btn').click(function(){
    //var btn = $(this);
	//btn.attr("disabled", true);
	var obj = $("#form2").serialize();
	//var vid = $('#tab1 .uk-active a').text();
    $.ajax({
        url: "{:url('user_edit')}",
        type: 'post',
        cache: false, 
		data: obj,
        dataType: 'json',
        success: function(rs) {
            if(rs == 1){location.reload();}else{alert('编辑失败');}
	    }
	});
});

</script>
</html>